package com.claude.sql;

import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;

public class SubjectTableManager implements TableManager{

	private SQLiteDatabase mSQLiteDatabase = null;
	public SubjectTableManager(SQLiteDatabase sqliteDatabase) {
		this.mSQLiteDatabase = sqliteDatabase;
	}
	
	@Override
	public boolean delete(String... args) {
		return false;
	}

	@Override
	public boolean update(String... args) {
		return false;
	}

	@Override
	public Cursor search(String... args) {
		try{
			Cursor cursor = mSQLiteDatabase.rawQuery("select * from subject where ano = ?", args);
			return cursor;
		}catch(SQLException error){
			return null;
		}
	}

	@Override
	public boolean insert(String... args) {
		mSQLiteDatabase.beginTransaction();
		try{
			mSQLiteDatabase.execSQL("insert into subject values(?, ?, ?)", args);
			mSQLiteDatabase.setTransactionSuccessful();
		}catch(SQLiteException error){
		}finally{
			mSQLiteDatabase.endTransaction();
		}
		return true;
	}

	@Override
	public boolean execStatement(String sqlStatement) {
		return false;
	}

	@Override
	public Cursor rawQueryStatement(String sqlStatement) {
		return null;
	}

}
